package com.ruoyi.bulkegg.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bulkegg.mapper.SupplyRelationCompanyMapper;
import com.ruoyi.bulkegg.domain.SupplyRelationCompany;
import com.ruoyi.bulkegg.service.ISupplyRelationCompanyService;

/**
 * 供应商关系Service业务层处理
 *
 * @author ruoyi
 * @date 2025-09-28
 */
@Service
@DataSource(DataSourceType.BULKEGG)
public class SupplyRelationCompanyServiceImpl implements ISupplyRelationCompanyService
{
    @Autowired
    private SupplyRelationCompanyMapper supplyRelationCompanyMapper;

    /**
     * 查询供应商关系
     *
     * @param companyId 供应商关系主键
     * @return 供应商关系
     */
    @Override
    public SupplyRelationCompany selectSupplyRelationCompanyByCompanyId(Long companyId)
    {
        return supplyRelationCompanyMapper.selectSupplyRelationCompanyByCompanyId(companyId);
    }

    /**
     * 根据供应商公司名称查询供应商关系
     *
     * @param supplierCompany 供应商公司名称
     * @return 供应商关系
     */
    @Override
    public SupplyRelationCompany selectSupplyRelationCompanyBySupplierCompany(String supplierCompany)
    {
        return supplyRelationCompanyMapper.selectSupplyRelationCompanyBySupplierCompany(supplierCompany);
    }

    /**
     * 查询供应商关系列表
     *
     * @param supplyRelationCompany 供应商关系
     * @return 供应商关系
     */
    @Override
    public List<SupplyRelationCompany> selectSupplyRelationCompanyList(SupplyRelationCompany supplyRelationCompany)
    {
        return supplyRelationCompanyMapper.selectSupplyRelationCompanyList(supplyRelationCompany);
    }

    /**
     * 新增供应商关系
     *
     * @param supplyRelationCompany 供应商关系
     * @return 结果
     */
    @Override
    public int insertSupplyRelationCompany(SupplyRelationCompany supplyRelationCompany)
    {
        supplyRelationCompany.setCreateTime(DateUtils.getNowDate());
        return supplyRelationCompanyMapper.insertSupplyRelationCompany(supplyRelationCompany);
    }

    /**
     * 修改供应商关系
     *
     * @param supplyRelationCompany 供应商关系
     * @return 结果
     */
    @Override
    public int updateSupplyRelationCompany(SupplyRelationCompany supplyRelationCompany)
    {
        supplyRelationCompany.setUpdateTime(DateUtils.getNowDate());
        return supplyRelationCompanyMapper.updateSupplyRelationCompany(supplyRelationCompany);
    }

    /**
     * 批量删除供应商关系
     *
     * @param companyIds 需要删除的供应商关系主键
     * @return 结果
     */
    @Override
    public int deleteSupplyRelationCompanyByCompanyIds(Long[] companyIds)
    {
        return supplyRelationCompanyMapper.deleteSupplyRelationCompanyByCompanyIds(companyIds);
    }

    /**
     * 删除供应商关系信息
     *
     * @param companyId 供应商关系主键
     * @return 结果
     */
    @Override
    public int deleteSupplyRelationCompanyByCompanyId(Long companyId)
    {
        return supplyRelationCompanyMapper.deleteSupplyRelationCompanyByCompanyId(companyId);
    }
}
